package com.ilink.teacherservice.mapper.study.tree;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ilink.teacherservice.entity.PO.study.tree.StudyTreeJsonNodeStatus;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface StudyTreeJsonNodeStatusMapper extends BaseMapper<StudyTreeJsonNodeStatus> {
    @Update("UPDATE study_tree_json_node_status SET json_status = #{jsonStatus} WHERE user_id = #{userId} AND json_id = #{jsonId}")
    void updateJsonStatus(@Param("userId") String userId, @Param("jsonId") Long jsonId, @Param("jsonStatus") String jsonStatus);

    @Select("SELECT json_status FROM study_tree_json_node_status WHERE user_id = #{userId} AND json_id = #{jsonId} LIMIT 1")
    String findJsonStatusByUserIdAndJsonId(@Param("userId") String userId, @Param("jsonId") Long jsonId);
}
